#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <algorithm>
#include <string>
#include <iostream>

struct Student {
	std::string name;
	int time;
} students[110];


bool MyCompare(const Student& p1, const Student& p2) {
	return p1.time < p2.time;
}

/**
 * 时间复杂度：O(nlogn)
 * 空间复杂度：O(n)
 * 
 * 第K名
 * @return
 */
int main() {

	int n, k;
	scanf("%d %d", &n, &k);

	for (int i=0; i<n; i++) {
		std::cin >> students[i].name >> students[i].time;
	}

	std::sort(students, students + n, MyCompare);

	std::cout << students[k-1].name;	

	return 0;
}



